import {
  ProFormDatePicker,
  ProFormDateRangePicker,
  ProTable,
} from '@ant-design/pro-components';
import {
  Button,
  Tag,
  Popconfirm,
  message,
  Breadcrumb,
  Select,
  Space,
  Table,
  Upload,
} from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { useRequest } from 'umi';
import {
  ModalForm,
  ProForm,
  ProFormSelect,
  ProFormText,
  ProFormInstance,
} from '@ant-design/pro-components';
import styles from './index.less';
import ImportExcel from '../ImportExcel';
import ReturnTablist from '@/components/TabList';
import React, { useEffect, useRef, useState } from 'react';
import SearchByRole from '@/components/SearchByRole';
import { useBoolean } from 'ahooks';
import { FileSearchOutlined } from '@ant-design/icons';
import type { UploadProps } from 'antd';
import ExportExcel from '@/components/ExportExcel2';

export default () => {
  const [tabKey, setTabKey] = useState('个人视角');
  const ref = useRef<ProFormInstance>();
  const [selectRow, { toggle }] = useBoolean(false);
  const formRef = useRef<ProFormInstance>(); //编辑modal的ref
  const addformRef = useRef<ProFormInstance>(); //新增modal的ref

  const { Option } = Select;

  const props: UploadProps = {
    name: 'file',
    action: 'http://10.1.40.84:9993/common/uploadFile',
    headers: {
      Authorization: localStorage.getItem('token') || '',
    },
    maxCount: 1,
    accept: '.docx,.doc,.pdf,.xls',
    onChange(info) {
      if (info.file.status !== 'uploading') {
        console.log(info.file, info.fileList);
      }
      if (info.file.status === 'done') {
        formRef.current?.setFieldsValue({
          annexPath: info?.file?.response.data,
        });
        addformRef.current?.setFieldsValue({
          annexPath: info?.file?.response.data,
        });
        message.success(`${info.file.name} 上传成功！`);
      } else if (info.file.status === 'error') {
        message.error(`${info.file.name} 上传失败！`);
      }
    },
  };

  //获取人才情况列表
  const getAllTalent = useRequest(
    (data = { auth: 0 }) => {
      return {
        url: `http://10.1.40.84:9993/academicJournals/getAllAcademicJournals`,
        method: 'POST',
        headers: {
          Authorization: localStorage.getItem('token') || '',
        },
        data,
      };
    },
    {
      onSuccess: (result) => {
        console.log(result);
      },
      formatResult: (res) => {
        let dataTemp: any = [];
        res.data.map((item: any) => {
          if (item.getYear !== null) {
            dataTemp.push({ ...item, getYear: item.getYear + '' });
          } else {
            dataTemp.push({ ...item, getYear: '' });
          }
        });
        return dataTemp;
      },
    },
  );
  //新增 人才情况
  const addTalentDetail = useRequest(
    (data = {}) => {
      return {
        url: `http://10.1.40.84:9993/academicJournals/addAcademicJournalsDetail`,
        method: 'POST',
        headers: {
          Authorization: localStorage.getItem('token') || '',
        },
        data,
      };
    },
    {
      manual: true,
    },
  );
  //更新人员
  const updateTalentDetail = useRequest(
    (data = undefined) => {
      return {
        url: `http://10.1.40.84:9993/academicJournals/updateAcademicJournalsDetail`,
        method: 'POST',
        headers: {
          Authorization: localStorage.getItem('token') || '',
        },
        data,
      };
    },
    {
      manual: true,
    },
  );
  //删除人员
  const deleteTalentDetail = useRequest(
    (data = undefined) => {
      return {
        url: `http://10.1.40.84:9993/academicJournals/deleteAcademicJournalsDetail`,
        method: 'POST',
        headers: {
          Authorization: localStorage.getItem('token') || '',
        },
        data,
      };
    },
    {
      manual: true,
    },
  );
  const confirm = (e: any) => {
    deleteTalentDetail.run({ id: e.id }).then(() => {
      getAllTalent.run();
      message.success('删除成功');
    });
  };
  const cancel = (e: any) => {
    message.error('已取消');
  };
  //修改状态
  const updateStatus = useRequest(
    (data = {}) => {
      return {
        url: 'http://10.1.40.84:9993/common/updateStatus',
        method: 'POST',
        headers: {
          Authorization: localStorage.getItem('token') || '',
        },
        data,
      };
    },
    {
      manual: true,
    },
  );
  const columns = [
    {
      title: '人员姓名',
      align: 'center',
      dataIndex: 'name',
      key: 'name',
      width: 100,
      hideInSearch: true,
    },
    {
      title: '任职年份',
      align: 'center',
      dataIndex: 'year',
      key: 'year',
      valueType: 'dateYear',
      hideInTable: true,
    },
    {
      title: '期刊名称',
      align: 'center',
      dataIndex: 'journalName',
      key: 'journalName',
      // copyable: true,
      // ellipsis: true,
      hideInSearch: true,
    },
    {
      title: '职务',
      align: 'center',
      dataIndex: 'journalTitle',
      key: 'journalTitle',
      hideInSearch: true,
    },
    {
      title: '任职起始时间',
      align: 'center',
      dataIndex: 'startTime',
      key: 'startTime',
      hideInSearch: true,
    },
    {
      title: '任职结束时间',
      align: 'center',
      dataIndex: 'endTime',
      key: 'endTime',
      hideInSearch: true,
    },
    {
      title: '国际/国内',
      align: 'center',
      dataIndex: 'isInternational',
      key: 'isInternational',
      hideInSearch: true,
    },
    {
      title: '是否重要',
      align: 'center',
      dataIndex: 'isImportant',
      key: 'isImportant',
      hideInSearch: true,
    },
    {
      title: '期刊收录情况',
      align: 'center',
      dataIndex: 'records',
      key: 'records',
      hideInSearch: true,
    },
    {
      title: '人员',
      align: 'center',
      key: 'name',
      dataIndex: 'name',
      hideInTable: true,
      hideInSearch: tabKey === '个人视角',
      renderFormItem: () => {
        return (
          <Select
            showSearch
            filterOption={(input, option) =>
              (option!.children as unknown as string)
                .toLowerCase()
                .includes(input.toLowerCase())
            }
          >
            {SearchByRole(tabKey)?.people?.map((item: any) => (
              <Option key={item.value} value={item.label}>
                {item.label}
              </Option>
            ))}
          </Select>
        );
      },
    },
    {
      title: '子方向',
      align: 'center',
      dataIndex: 'groupId',
      key: 'groupId',
      hideInTable: true,
      hideInSearch: tabKey === '个人视角' || tabKey === '子方向视角',
      renderFormItem: () => {
        return (
          <Select
            showSearch
            filterOption={(input, option) =>
              (option!.children as unknown as string)
                .toLowerCase()
                .includes(input.toLowerCase())
            }
          >
            {SearchByRole(tabKey)?.team?.map((item: any) => (
              <Option key={item.value} value={item.value}>
                {item.label}
              </Option>
            ))}
          </Select>
        );
      },
    },
    {
      title: '方向',
      align: 'center',
      dataIndex: 'directionId',
      key: 'directionId',
      hideInTable: true,
      hideInSearch: tabKey !== '管理员视角',
      renderFormItem: () => {
        return (
          <Select
            showSearch
            filterOption={(input, option) =>
              (option!.children as unknown as string)
                .toLowerCase()
                .includes(input.toLowerCase())
            }
          >
            {SearchByRole(tabKey)?.direction?.map((item: any) => (
              <Option key={item.value} value={item.value}>
                {item.label}
              </Option>
            ))}
          </Select>
        );
      },
    },
    {
      title: '任职年份',
      align: 'center',
      dataIndex: 'years',
      key: 'years',
      hideInSearch: true,
      render: (text: any) =>
        (text || [])?.sort().map((item: any, index: any) => {
          return <Tag key={index}>{item}</Tag>;
        }),
    },
    {
      title: '材料',
      align: 'center',
      dataIndex: 'annexPath',
      key: 'annexPath',
      hideInSearch: true,
      render: (text: any, record: any) => {
        if (record.annexPath !== null) {
          return (
            <a
              onClick={() => {
                window.open(text);
              }}
            >
              下载
            </a>
          );
        } else {
          return <span>暂无材料</span>;
        }
      },
    },
    {
      title: '状态',
      align: 'center',
      key: 'finalStr',
      dataIndex: 'finalStr',
      hideInSearch: true,
      filters: true,
      onFilter: true,
      valueType: 'select',
      valueEnum: {
        未提交: { text: '未提交' },
        待上传文件: {
          text: '待上传文件',
        },
        待用户修改: {
          text: '待用户修改',
        },
        待子方向负责人审核: {
          text: '待子方向负责人审核',
        },
        待子方向负责人确认: {
          text: '待子方向负责人确认',
        },
        待管理员审核: {
          text: '待管理员审核',
        },
      },
    },
    {
      title: '操作',
      key: 'option',
      valueType: 'option',
      width: '18%',
      render: (text: any, record: any) => {
        let optionName: any = '';
        let singleRefuseShow: boolean = false;
        let singleRefuseDisabled: boolean = true;

        if (tabKey === '管理员视角') {
          if (record.finalStr === '待管理员审核') {
            singleRefuseDisabled = false;
            optionName = '修改';
          } else {
            optionName = '查看';
          }
        } else {
          if (tabKey === '子方向视角') {
            if (record.finalStr === '待子方向负责人审核') {
              optionName = '修改';
              singleRefuseDisabled = false;
            } else if (record.finalStr === '待子方向负责人确认') {
              optionName = '审核';
            } else {
              optionName = '查看';
            }
          }
          if (tabKey === '方向视角') {
            optionName = '查看';
            singleRefuseShow = true;
          }
          if (tabKey === '个人视角') {
            singleRefuseShow = true;
            if (record.finalStr === '未提交') {
              optionName = '继续填写';
            } else if (
              record.finalStr === '待用户修改' ||
              record.finalStr === '待上传文件'
            ) {
              optionName = '修改';
            } else {
              optionName = '查看';
            }
          }
        }
        let deleteHidden: boolean = true;
        if (tabKey === '管理员视角') {
          deleteHidden = false;
        } else {
          if (
            record.finalStr === '待子方向负责人审核' ||
            record.finalStr === '未提交' ||
            record.finalStr === '待上传文件'
          ) {
            deleteHidden = false;
          }
        }
        return (
          <Space>
            <ModalForm
              title={
                record?.message ? (
                  <div>
                    {optionName}{' '}
                    <span style={{ color: 'red', textAlign: 'center' }}>
                      {'(拒绝原因：' + record?.message + ')'}
                    </span>{' '}
                  </div>
                ) : (
                  optionName
                )
              }
              trigger={
                <a
                  onClick={() => {
                    console.log(record);
                  }}
                >
                  {optionName}
                </a>
              }
              autoFocusFirstInput
              modalProps={{
                onCancel: () => console.log('run'),
                destroyOnClose: true,
              }}
              submitTimeout={2000}
              onFinish={async (values) => {
                if (optionName !== '审核') {
                  updateTalentDetail.run(values).then(() => {
                    getAllTalent.run({ auth: authAdapter(tabKey) });
                  });
                } else {
                  if (values?.annexPath) {
                    if (values.sumbitType === '提交管理员审核') {
                      updateTalentDetail.run(values).then(() => {
                        updateStatus
                          .run({
                            tableName: 'ACADEMIC_JOURNALS',
                            ids: [record.id],
                            status: 2, //审核通过
                            tab: '子方向视角',
                          })
                          .then(() => {
                            getAllTalent.run({ auth: authAdapter(tabKey) });
                            message.success('操作成功');
                          });
                      });
                    } else if (values.sumbitType === '返回成员修改') {
                      return true;
                    }
                  } else {
                    message.warning('缺少文件！');
                  }
                }
                return true;
              }}
              key="1"
              initialValues={
                record.getYear === ''
                  ? { ...record, getYear: undefined }
                  : record
              }
              grid={true}
              formRef={formRef}
              // visible={editModal}
              // onVisibleChange={setEditModal}
              submitter={{
                render: (props, doms) => {
                  if (optionName === '审核') {
                    return [
                      <ModalForm
                        key="ModalForm"
                        title="返回成员修改"
                        trigger={
                          <Button
                            key="2"
                            onClick={() => {
                              formRef.current?.setFieldsValue({
                                sumbitType: '返回成员修改',
                              });
                            }}
                          >
                            返回成员修改
                          </Button>
                        }
                        autoFocusFirstInput
                        modalProps={{
                          onCancel: () => console.log('run'),
                          destroyOnClose: true,
                        }}
                        submitTimeout={2000}
                        onFinish={async (values) => {
                          console.log(values);
                          updateStatus
                            .run({
                              tableName: 'ACADEMIC_JOURNALS',
                              ids: [record.id],
                              status: 3, //拒绝
                              message: values.message,
                              tab: '子方向视角',
                            })
                            .then(() => {
                              getAllTalent.run({ auth: authAdapter(tabKey) });
                              message.success('操作成功');
                            });
                          props.form?.submit();
                          return true;
                        }}
                        grid={true}
                        initialValues={{ message: record?.message }}
                      >
                        <ProForm.Group>
                          <ProFormText
                            name="message"
                            label="拒绝原因"
                            placeholder="请输入拒绝原因"
                            colProps={{ span: 24 }}
                            rules={[
                              { required: true, message: '请输入拒绝原因' },
                            ]}
                          />
                        </ProForm.Group>
                      </ModalForm>,
                      <Button
                        key="edit"
                        type="primary"
                        onClick={() => {
                          formRef.current?.setFieldsValue({
                            sumbitType: '提交管理员审核',
                          });
                          props.form?.submit();
                        }}
                      >
                        提交管理员审核
                      </Button>,
                    ];
                  } else if (optionName === '查看') {
                    return false;
                  } else if (optionName === '修改') {
                    return doms;
                  }
                },
              }}
            >
              <ProForm.Group>
                <ProFormText width="sm" name="id" hidden />
                <ProFormText
                  colProps={{ span: 12 }}
                  name="name"
                  label="姓名"
                  rules={[{ required: true, message: '请输入姓名!' }]}
                  disabled={optionName === '查看'}
                />
                <ProFormText
                  colProps={{ span: 12 }}
                  name="journalName"
                  label="期刊名称"
                  rules={[{ required: true, message: '请输入荣誉称号!' }]}
                  disabled={optionName === '查看'}
                />
                <ProFormText
                  name="journalTitle"
                  label="任职"
                  disabled={optionName === '查看'}
                  colProps={{ span: 12 }}
                  rules={[{ required: true, message: '请输入任职!' }]}
                />
                <ProFormDateRangePicker
                  colProps={{ span: 12 }}
                  width={375}
                  fieldProps={{
                    picker: 'month',
                    format: 'YYYY-MM',
                  }}
                  name="time"
                  label="开始时间-结束时间"
                  rules={[{ required: true, message: '请选择起止时间!' }]}
                  disabled={optionName === '查看'}
                />

                <ProFormSelect
                  colProps={{ span: 12 }}
                  options={[
                    {
                      value: '国际',
                      label: '国际',
                    },
                    {
                      value: '国内',
                      label: '国内',
                    },
                  ]}
                  name="isInternational"
                  label="国际/国内"
                  rules={[{ required: true, message: '请输入国际/国内' }]}
                  disabled={optionName === '查看'}
                />
                <ProFormSelect
                  colProps={{ span: 12 }}
                  options={[
                    {
                      value: '是',
                      label: '是',
                    },
                    {
                      value: '否',
                      label: '否',
                    },
                  ]}
                  name="isImportant"
                  label="是否重要"
                  rules={[{ required: true, message: '请输入是否重要' }]}
                  disabled={optionName === '查看'}
                />
                <ProFormText
                  colProps={{ span: 12 }}
                  name="records"
                  label="期刊收录情况"
                  rules={[{ required: true, message: '请输入期刊收录情况' }]}
                  disabled={optionName === '查看'}
                />
                <ProFormSelect
                  colProps={{ span: 12 }}
                  options={[
                    {
                      value: 2026,
                      label: '2026',
                    },
                    {
                      value: 2025,
                      label: '2025',
                    },
                    {
                      value: 2024,
                      label: '2024',
                    },
                    {
                      value: 2023,
                      label: '2023',
                    },
                    {
                      value: 2022,
                      label: '2022',
                    },
                    {
                      value: 2021,
                      label: '2021',
                    },
                    {
                      value: 2020,
                      label: '2020',
                    },
                    {
                      value: 2019,
                      label: '2019',
                    },
                    {
                      value: 2018,
                      label: '2018',
                    },
                    {
                      value: 2017,
                      label: '2017',
                    },
                  ]}
                  name="years"
                  label="任职年份"
                  mode="multiple"
                  rules={[{ required: true, message: '请输入任职年份!' }]}
                  disabled={optionName === '查看'}
                />
                <Upload {...props}>
                  <Button
                    type="link"
                    style={{ marginTop: 30 }}
                    disabled={optionName === '查看'}
                  >
                    上传材料
                  </Button>
                </Upload>
                <ProFormText name="annexPath" hidden />
                <ProFormText name="sumbitType" hidden />
              </ProForm.Group>
            </ModalForm>
            <Button
              type="link"
              key="agree"
              size="small"
              hidden={singleRefuseShow}
              disabled={singleRefuseDisabled}
              onClick={() => {
                updateStatus
                  .run({
                    tableName: 'ACADEMIC_JOURNALS',
                    ids: [record.id],
                    status: 2, //审核通过
                    tab: tabKey,
                  })
                  .then(() => {
                    message.success('操作成功');
                    getAllTalent.run({ auth: authAdapter(tabKey) });
                  });
              }}
            >
              同意
            </Button>
            <ModalForm
              title="拒绝"
              trigger={
                <Button
                  type="link"
                  size="small"
                  hidden={singleRefuseShow}
                  disabled={singleRefuseDisabled}
                >
                  拒绝
                </Button>
              }
              autoFocusFirstInput
              modalProps={{
                onCancel: () => console.log('run'),
                destroyOnClose: true,
              }}
              submitTimeout={2000}
              onFinish={async (values) => {
                console.log(values);
                updateStatus
                  .run({
                    tableName: 'ACADEMIC_JOURNALS',
                    ids: [record.id],
                    status: 3, //拒绝
                    message: values.message,
                    tab: tabKey,
                  })
                  .then(() => {
                    message.success('操作成功');
                    getAllTalent.run({ auth: authAdapter(tabKey) });
                  });
                return true;
              }}
              grid={true}
              initialValues={{ message: record.message }}
            >
              <ProForm.Group>
                <ProFormText
                  name="message"
                  label="拒绝原因"
                  placeholder="请输入拒绝原因"
                  colProps={{ span: 24 }}
                  rules={[{ required: true, message: '请输入拒绝原因' }]}
                />
              </ProForm.Group>
            </ModalForm>
            <Popconfirm
              key={'2'}
              title="确定删除吗？"
              onConfirm={() => confirm(record)}
              onCancel={() => cancel}
              okText="确定"
              cancelText="取消"
            >
              <Button type="link" disabled={deleteHidden} size="small">
                删除
              </Button>
            </Popconfirm>
          </Space>
        );
      },
    },
  ];
  const authAdapter = (key: any) => {
    let authTemp: any = 0;
    if (key === '个人视角') {
      authTemp = 0;
    }
    if (key === '子方向视角') {
      authTemp = 1;
    }
    if (key === '方向视角') {
      authTemp = 2;
    }
    if (key === '管理员视角') {
      authTemp = 3;
    }
    return authTemp;
  };

  return (
    <PageContainer
      header={{
        title:
          '选取年份查询后,绿色代表当年该人员新加入某学术期刊任职，红色代表当年该人员退出某学术期刊',
        breadcrumb: (
          <Breadcrumb>
            <Breadcrumb.Item>队伍建设与人才培养</Breadcrumb.Item>
            <Breadcrumb.Item>学术期刊任职</Breadcrumb.Item>
          </Breadcrumb>
        ),
      }}
      tabList={ReturnTablist()}
      onTabChange={(key: any) => {
        setTabKey(key);
        getAllTalent.run({ auth: authAdapter(key) });
        ref.current?.resetFields();
      }}
    >
      <ProTable
        columns={columns}
        dataSource={getAllTalent?.data || []}
        rowKey="id"
        formRef={ref}
        pagination={{
          showQuickJumper: true,
        }}
        rowClassName={(record: any) => {
          if (record.yearFlag === '离开') {
            return styles.leave;
          } else if (record.yearFlag === '正常') {
            return null;
          } else if (record.yearFlag === '新增') {
            return styles.add;
          } else {
            return null;
          }
        }}
        dateFormatter="string"
        headerTitle="人员列表"
        options={false}
        onReset={() => {
          getAllTalent.run({ auth: authAdapter(tabKey) });
        }}
        onSubmit={(e) => {
          getAllTalent.run({ auth: authAdapter(tabKey), ...e });
        }}
        toolBarRender={() => [
          <div>
            <ExportExcel
              key="ExportExcel"
              dataSource={getAllTalent?.data}
              columns={columns}
            />
            {tabKey === '管理员视角' || tabKey === '子方向视角' ? (
              <Button
                type="primary"
                icon={<FileSearchOutlined />}
                onClick={() => {
                  toggle();
                }}
              >
                批量审核
              </Button>
            ) : null}
          </div>,
          <ModalForm
            title="新增学术期刊"
            trigger={
              <Button key="primary" type="primary">
                新增学术期刊任职
              </Button>
            }
            autoFocusFirstInput
            modalProps={{
              onCancel: () => console.log('run'),
              destroyOnClose: true,
            }}
            submitTimeout={2000}
            onFinish={async (values) => {
              console.log(values);
              if (values.annexPath && values.annexPath !== '') {
                addTalentDetail.run(values).then(() => {
                  getAllTalent.run();
                });
              } else {
                message.error('请上传文件');
                return false;
              }
              return true;
            }}
            key="1"
            grid={true}
            formRef={addformRef}
          >
            <ProForm.Group>
              <ProFormText
                colProps={{ span: 12 }}
                name="name"
                label="姓名"
                rules={[{ required: true, message: '请输入姓名!' }]}
              />
              <ProFormText
                colProps={{ span: 12 }}
                name="journalName"
                label="期刊名称"
                rules={[{ required: true, message: '请输入荣誉称号!' }]}
              />
              <ProFormText
                name="journalTitle"
                label="任职"
                colProps={{ span: 12 }}
                rules={[{ required: true, message: '请输入任职!' }]}
              />
              <ProFormDateRangePicker
                colProps={{ span: 12 }}
                width={375}
                fieldProps={{
                  picker: 'month',
                  format: 'YYYY-MM',
                }}
                name="time"
                label="开始时间-结束时间"
                rules={[{ required: true, message: '请选择起止时间!' }]}
              />
              <ProFormSelect
                colProps={{ span: 12 }}
                options={[
                  {
                    value: '国际',
                    label: '国际',
                  },
                  {
                    value: '国内',
                    label: '国内',
                  },
                ]}
                name="isInternational"
                label="国际/国内"
                rules={[{ required: true, message: '请输入国际/国内' }]}
              />
              <ProFormSelect
                colProps={{ span: 12 }}
                options={[
                  {
                    value: '是',
                    label: '是',
                  },
                  {
                    value: '否',
                    label: '否',
                  },
                ]}
                name="isImportant"
                label="是否重要"
                rules={[{ required: true, message: '请输入是否重要' }]}
              />
              <ProFormText
                colProps={{ span: 12 }}
                name="records"
                label="期刊收录情况"
                rules={[{ required: true, message: '请输入期刊收录情况' }]}
              />
              <ProFormSelect
                colProps={{ span: 12 }}
                options={[
                  {
                    value: 2026,
                    label: '2026',
                  },
                  {
                    value: 2025,
                    label: '2025',
                  },
                  {
                    value: 2024,
                    label: '2024',
                  },
                  {
                    value: 2023,
                    label: '2023',
                  },
                  {
                    value: 2022,
                    label: '2022',
                  },
                  {
                    value: 2021,
                    label: '2021',
                  },
                  {
                    value: 2020,
                    label: '2020',
                  },
                  {
                    value: 2019,
                    label: '2019',
                  },
                  {
                    value: 2018,
                    label: '2018',
                  },
                  {
                    value: 2017,
                    label: '2017',
                  },
                ]}
                name="years"
                label="任职年份"
                mode="multiple"
                rules={[{ required: true, message: '请输入任职年份!' }]}
              />
              <Upload {...props}>
                <Button type="link" style={{ marginTop: 30 }}>
                  上传材料
                </Button>
              </Upload>
              <ProFormText name="annexPath" hidden />
            </ProForm.Group>
          </ModalForm>,
        ]}
        rowSelection={
          selectRow
            ? {
                selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
                getCheckboxProps: (record) => {
                  let selectRowTag: boolean = true;
                  if (tabKey === '子方向视角') {
                    if (record.finalStr === '待子方向负责人审核') {
                      selectRowTag = false;
                    }
                  }
                  if (tabKey === '管理员视角') {
                    if (record.finalStr === '待管理员审核') {
                      selectRowTag = false;
                    }
                  }
                  return { disabled: selectRowTag };
                },
              }
            : false
        }
        tableAlertOptionRender={({
          selectedRowKeys,
          selectedRows,
          onCleanSelected,
        }) => (
          <Space size={16}>
            <a style={{ marginLeft: 8 }} onClick={onCleanSelected}>
              取消选择
            </a>
            <a
              onClick={() => {
                updateStatus
                  .run({
                    tableName: 'ACADEMIC_JOURNALS',
                    ids: selectedRowKeys,
                    status: 2, //审核通过
                    tab: tabKey,
                    // tabKey
                  })
                  .then(() => {
                    message.success('操作成功');
                    onCleanSelected();
                    toggle();
                    getAllTalent.run({ auth: authAdapter(tabKey) });
                  });
              }}
            >
              {tabKey === '子方向视角' ? '提交管理员审核' : '审核通过'}
            </a>
          </Space>
        )}
      />
    </PageContainer>
  );
};
